package cn.xorange.commons.system.controller.system;

import cn.xorange.commons.core.basic.bean.ResultBean;
import cn.xorange.commons.core.basic.controller.DataController;
import cn.xorange.commons.security.annotation.Authorize;
import cn.xorange.commons.system.entity.system.SysRoleManage;
import cn.xorange.commons.system.service.System.ISysRoleManageService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : yangjian
 * date : 2024/12/19
 * description :
 */
@RestController
@Authorize(hasPerm = "system:roleManage")
@RequestMapping("/system/roleManage")
public class SysRoleManageController extends DataController<SysRoleManage, ISysRoleManageService> {

    @Authorize(hasPerm = "query")
    @GetMapping("/{id}")
    public ResultBean info(@PathVariable(value = "id") Long id){
        List<Long> mOrgIds = this.service.getRoleManageOrgIds(id);
        return ResultBean.onSuccess(this.service.getById(id)).put("orgIds",mOrgIds);
    }
}
